<!DOCTYPE html>
 <html lang="en">
 <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initi
 al-scale=1.0">
    <title>bind⽅法实验</title>
 </head>
<body>
     <script>
function foo(name, age, height, address) {
 console.log("foo:", this);
 console.log("参数:", name, age, height, address);
 }
 var obj = { name: "gkd" };

 var bar = foo.bind(obj);
 bar(); // this -> obj

 var barWithArgs = foo.bind(obj, "kobe", 18, 1.88);
 barWithArgs("james"); // 仅“james”作为额外参数传⼊
    </script>
 </body>
 </html>
 
